package com.vote.wx.controller;

import com.alibaba.fastjson2.JSONObject;
import com.vote.common.annotation.Anonymous;
import com.vote.common.core.domain.ResponseResult;
import com.vote.wx.service.PublicCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.util.HashMap;
import java.util.Map;

/**
 * @author WanShen
 * @date 2024年01月26日 13:43
 */
@RestController
@RequestMapping("/wx")
public class WeChatLoginController {

    @Autowired
    private PublicCodeService publicCodeService;

    @GetMapping(value = "/login")
    @Anonymous
    public ResponseResult login(String code) {
//        拿到code直接获取用户的OpenId
        System.err.println("code==" + code);
        return publicCodeService.login(code);
    }

}
